#include <iostream>
#include <math.h>
#include <map>
#include <queue>
using namespace std;
map<int,bool> mp;


int dfs(int n,int k,int sum,int *a){
	if(k == n){
		if(mp[sum] == false){
			mp[sum] = true;
			return 1;
		}
		else
			return 0;
	}
	return dfs(n,k+1,sum,a)+dfs(n,k+1,sum+a[k],a);
}




int main(){
	map<int,int> num;
	int n,m;
	cin>>n>>m;
	int a[n];
	int mx=0,index=-1;
	for(int i=0;i<n;i++){
		cin>>a[i];
		num[a[i]]++;
		if(num[a[i]] > mx){
			mx = num[a[i]];
			index = i;
		}
		if(num[a[i]] == mx){
			if(a[i] > a[index])
				continue;
			else{
				mx = num[a[i]];
				index = i;
			}
		}
	}
	a[index] = a[n-1];
	cout<<dfs(n-1,0,0,a)-1;
	return 0;
}
